package at.fhooe.engine.mapobject;

import at.fhooe.engine.entity.Updateable;

public abstract class MapObject implements Updateable {

	protected String m_mapObjectId;
	protected String m_name;
	protected double m_positionX;
	protected double m_positionY;
	protected double m_size;
	
	public MapObject(String mapObjectId, String name, double posX, double posY, double size) {
		m_mapObjectId = mapObjectId;
		m_name = name;
		m_positionX = posX;
		m_positionY = posY;
		m_size = size;
	}
	
	public boolean equals(Object other){
		if(other instanceof MapObject)
		{
			return m_name.equals(((MapObject) other).getName());
		}
		return super.equals(other);
	}
	
	public void engage() {
		initialize();
	}
	
	public void disengage() {
		deinitialize();
	}
	
	public String getMapObjectId() {
		return m_mapObjectId;
	}

	public String getName() {
		return m_name;
	}

	public double getPositionX() {
		return m_positionX;
	}

	public double getPositionY() {
		return m_positionY;
	}

	public double getSize() {
		return m_size;
	}
	
	protected abstract void initialize();
	
	protected abstract void deinitialize();

	@Override
	public abstract void update();

}
